博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
完成个人中心—导航标签
阅读量:7051 次
发布时间:2019-06-28

本文共 1170 字,大约阅读时间需要 3 分钟。

个人中心—视图函数带标签页面参数tag

@app.route('/usercenter/<user_id>/<tag>')
def usercenter(user_id, tag):
   if tag == ‘1':
       return render_template('usercenter1.html', **context)

@app.route('/usercenter/
/
')@loginFirstdef usercenter(user_id,tag): user = User.query.filter(User.id == user_id).first() context = { 'username':user.username, 'questions':user.questions, 'comments':user.comments } if tag =='question': return render_template('user question.html',**context) elif tag =='comment': return render_template('user comment.html', **context) else: return render_template('user information.html', **context)

个人中心—导航标签链接增加tag参数

<li role=“presentation”><a href=“{
{ url_for(‘usercenter’,user_id = user.id,tag = ‘1’) }}">全部问答</a></li>

个人中心—有链接到个人中心页面的url增加tag参数

u <a href="{
{ url_for('usercenter',user_id = session.get('userid'), tag=1) }}">{
{ session.get('user') }}</a>

 

转载于:https://www.cnblogs.com/951111ldj/p/8042607.html

你可能感兴趣的文章
初识 sqlite 与 content provider 学习笔记
查看>>
java--ftp的断点上传和断点下载
查看>>
11.SSH整合
查看>>
PowerShell记录脚本运行过程
查看>>
OpenSUSE下启动ssh和samba服务以及防火墙设置
查看>>
linux nethogs查看进程流量
查看>>
pip 安装报utf-8错解决办法
查看>>
django 中form在html中的简单使用
查看>>
lync 2013标准版安装
查看>>
【C#】在主线程中取消任务的运行方式
查看>>
POJ-2715(Water)
查看>>
防止集群多节点存储访问方法
查看>>
菜鸟学习Linux集群之概念篇
查看>>
我的友情链接
查看>>
使用yum时用Ctrl+C强制终止出现的Error: rpmdb open failed解决方案
查看>>
画家王路平简历
查看>>
《系统运维全面解析:技术、管理与实践》章节目录
查看>>
linux 函数追踪器
查看>>
ubuntu 更换阿里云的源
查看>>
脚本禁言鼠标右键
查看>>